package com.mbg17.service.controller;

import com.mbg17.service.service.TestRecordService;
import com.mbg17.service.service.impl.TaskActuator;
import com.mbg17.utils.ResultUtil;
import com.mbg17.domain.Result;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RequestMapping("/interface")
@RestController
public class TaskController {
    @Resource
    private TestRecordService testRecordService;

    @Resource
    private TaskActuator taskActuator;

    @Resource
    private AmqpTemplate rabbitTemplate;
    @GetMapping("/interface/{taskId}")
    public Result addTask(@PathVariable("taskId") Integer taskId){
        rabbitTemplate.convertAndSend("interface",taskId);
        return ResultUtil.success(testRecordService.getAllTestRecord(),"调用接口成功！");
    }
}
